package goleetcode

func isArraySpecial(nums []int) bool {
	if len(nums) == 1 {
		return true
	}

	for i := 0; i < len(nums) - 1; i++ {
		j := i + 1
		if !judge(nums[i], nums[j]) {
			return false
		}
	}

	return true
}

func judge(i, j int) bool {
	if i % 2 == 0 && j % 2 == 0 {
		return false
	} else if i % 2 == 1 && j % 2 == 1 {
		return false
	}
	return true
}